package cn.edu.xmu.oomall.customer.microservice.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;

/**
 * @author Haotian Cheng
 * @date 2021-12-14 12:41:47
 */
/**
 * @modifiedBy Jiazhe Yuan
 * @date 2021-12-22 00:59:09
 * @modify 时间格式转换为ZoneDateTime
 */
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class ProductVoInfo {

    private Long id;

    private Long shopId;

    private String shopName;

    private Long goodsId;


    private Long categoryId;
    private String categoryName;
    private Long freightId;

    private String skuSn;


    private String name;


    private Long originalPrice;


    private Long weight;


    private String imageUrl;

    private String barcode;


    private String unit;

    private String originPlace;

    private Long creatorId;

    private String creatorName;


    private Long modifierId;


    private String modifierName;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "uuuu-MM-dd'T'HH:mm:ss.SSSZZZZZ")
    private ZonedDateTime gmtCreate;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "uuuu-MM-dd'T'HH:mm:ss.SSSZZZZZ")
    private ZonedDateTime gmtModified;


    private Byte state;

    private Long onSaleId;

    private Long price;

    private Integer quantity;

    public enum ProductState {
        /**
         * 共四种状态
         */
        DRAFT(0, "草稿"),
        OFFSHELF(1, "下架"),
        ONSHELF(2, "上架"),
        BANNED(3, "禁售中");
        private int code;
        private String state;

        ProductState(int code, String state) {
            this.code = code;
            this.state = state;
        }

        public int getCode() {
            return code;
        }

        public String getState() {
            return state;
        }
    }
}
